/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.femass.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;


@Entity
@Table(name = "Revisor")
@NamedQueries({
    @NamedQuery(name = "Revisor.findAll", query = "SELECT r FROM Revisor r"),
    @NamedQuery(name = "Revisor.findByCod", query = "SELECT r FROM Revisor r WHERE r.cod = :cod"),
    @NamedQuery(name = "Revisor.findByNome", query = "SELECT r FROM Revisor r WHERE r.nome = :nome"),
    @NamedQuery(name = "Revisor.findByTitulacao", query = "SELECT r FROM Revisor r WHERE r.titulacao = :titulacao")})
public class Revisor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cod")
    private Integer cod;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "nome")
    private String nome;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "titulacao")
    private String titulacao;
    @JoinColumn(name = "Tema_cod", referencedColumnName = "cod")
    @ManyToOne(optional = false)
    private Tema temacod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "revisor")
    private List<Avaliacao> avalicacaoList;

    public Revisor() {
    }

    public Revisor(Integer cod) {
        this.cod = cod;
    }

    public Revisor(Integer cod, String nome, String titulacao) {
        this.cod = cod;
        this.nome = nome;
        this.titulacao = titulacao;
    }

    public Integer getCod() {
        return cod;
    }

    public void setCod(Integer cod) {
        this.cod = cod;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getTitulacao() {
        return titulacao;
    }

    public void setTitulacao(String titulacao) {
        this.titulacao = titulacao;
    }

    public Tema getTemacod() {
        return temacod;
    }

    public void setTemacod(Tema temacod) {
        this.temacod = temacod;
    }

    public List<Avaliacao> getAvalicacaoList() {
        return avalicacaoList;
    }

    public void setAvalicacaoList(List<Avaliacao> avalicacaoList) {
        this.avalicacaoList = avalicacaoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cod != null ? cod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Revisor)) {
            return false;
        }
        Revisor other = (Revisor) object;
        if ((this.cod == null && other.cod != null) || (this.cod != null && !this.cod.equals(other.cod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.femass.model.Revisor[ cod=" + cod + " ]";
    }

}
